from ElGamal import ElGamal

if __name__ == "__main__":

    elg = ElGamal()
    keys, m = elg.generateKeys(10), 200110720
    sig = elg.signature(keys, m)
    print("进行ElGamal签名的消息:", m)
    if elg.verify(keys, m, sig):
        print("签名有效.")
    else:
        print("签名无效.")
    elg.showDetails()

    sig = elg.signature(keys, m)
    print("进行ElGamal签名的消息:", m)
    if elg.verify(keys, m, sig):
        print("签名有效.")
    else:
        print("签名无效.")
    elg.showDetails()


    sig = elg.signature(keys, m)
    print("进行ElGamal签名的消息:", m)
    print("签名认证时篡改消息为:",m+1)
    if elg.verify(keys, m+1, sig):
        print("签名有效.")
    else:
        print("签名无效.")
    elg.showDetails()